package com.yidu.verycd_background.service.impl;

import com.yidu.verycd_background.dao.VerycdCommentDao;
import com.yidu.verycd_background.entity.VerycdComment;
import com.yidu.verycd_background.service.VerycdCommentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (VerycdComment)表服务实现类
 *
 * @author makejava
 * @since 2020-07-27 09:57:00
 */
@Service("verycdCommentService")
public class VerycdCommentServiceImpl implements VerycdCommentService {
    @Resource
    private VerycdCommentDao verycdCommentDao;

    /**
     * 通过ID查询单条数据
     *
     * @param comId 主键
     * @return 实例对象
     */
    @Override
    public VerycdComment queryById(Integer comId) {
        return this.verycdCommentDao.queryById(comId);
    }

    @Override
    public List<VerycdComment> queryAllByLimit(int page,int limit){
        page=(page-1)*limit;
        return this.verycdCommentDao.queryAllByLimit(page,limit);
    }


    /**
     * 新增数据
     *
     * @param verycdComment 实例对象
     * @return 实例对象
     */
    @Override
    public VerycdComment insert(VerycdComment verycdComment) {
        this.verycdCommentDao.insert(verycdComment);
        return verycdComment;
    }

    /**
     * 修改数据
     *
     * @param verycdComment 实例对象
     * @return 实例对象
     */
    @Override
    public int update(VerycdComment verycdComment) {

        return this.verycdCommentDao.update(verycdComment);
    }

    /**
     * 通过主键删除数据
     *
     * @param comId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer comId) {
        return this.verycdCommentDao.deleteById(comId) > 0;
    }

    @Override
    public int selectCount() {
        return this.verycdCommentDao.selectCount();
}
}